package com.heima.admin.controller;

import com.heima.apis.article.IWemediaClient;
import com.heima.model.admin.dtos.NewsAuthDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmNewsPageReqDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/admin/api/v1/news")
public class AuditArticleController {

    @Autowired
    private IWemediaClient iWemediaClient;
    /**
     * 查询文章列表
     *
     */
    @PostMapping("/list_vo")
    public ResponseResult listVo(NewsAuthDto newsAuthDto) {
        /**
         * 去找到分页的数据
         */
        log.info("页数："+newsAuthDto.getPage());
        log.info("条数："+newsAuthDto.getPage());
        WmNewsPageReqDto wmNewsPageReqDto = new WmNewsPageReqDto();
        BeanUtils.copyProperties(newsAuthDto,wmNewsPageReqDto);

        ResponseResult result = iWemediaClient.list(wmNewsPageReqDto);
        //拿到分页数据
        return result;
    }

}
